package vn.fpt.snake.controller;
import java.util.List;

import vn.fpt.snake.entity.HighScore;
import vn.fpt.snake.entity.Settings;

public class OptionsControllerImpl extends AbstractController {
	Settings settings;
	public OptionsControllerImpl(){
		super();
		settings = dataAccess.getSettings();
	}
	public List<HighScore> getHighScores() throws Exception{
		return dataAccess.getHighScores();
	}
	
	public int compareHighScore(int newScore) throws Exception {
		List<HighScore> highScores = dataAccess.getHighScores();
		int size = highScores.size();	
		for (int i = 0; i < size; i++) {
			if (newScore > highScores.get(i).getScore()) {
				return i;
			}
		}
		return -1;
	}
	
	public void setNewHighScore(int index, HighScore newHighScore) throws Exception{
		List<HighScore> highScores = dataAccess.getHighScores();
		if (index != -1) {
			highScores.add(index, newHighScore);
		}
		dataAccess.saveHighScores(highScores);
	}
	
	public int getGameSpeed(){
		throw new UnsupportedOperationException();
	}
	
	public void setGameSpeed(int speed){
		throw new UnsupportedOperationException();
	}
	
	public int getVolume(){
		throw new UnsupportedOperationException();
	}
	
	public void setVolume(int volume){
		throw new UnsupportedOperationException();
	}	

	public void seeInstruction(){
		throw new UnsupportedOperationException();
	}
}
